<template>
    <div class="app-container h-auto min-h-full">
        <vxe-tip status="primary">

            <p>自定义名称: openLabel closeLabel</p>
            <p>自定义值：openValue closeValue</p>
        </vxe-tip>
        <vxe-tip status="warning">
            当使用自定义值时，需要添加 itemRender下添加defaultValue属性设置默认值
        </vxe-tip>
        <y-form :options="formOptions" @submit="submit"></y-form>
    </div>
</template>

<script>
export default {
    data() {
        return {
            formOptions: {
                titleWidth: 120,
                data: {},
                items: [
                    { field: 'flag1', title: '开关', span: 24, itemRender: { name: 'VxeSwitch' } },
                    { field: 'flag2', title: '自定义名称', span: 24, itemRender: { name: 'VxeSwitch', props: { openLabel: '启用', closeLabel: '禁用' } } },
                    { field: 'flag3', title: '自定义值', span: 24, itemRender: { name: 'VxeSwitch', defaultValue: '1', props: { openValue: '1', closeValue: '0' } } },
                    {
                        align: 'center', span: 24, itemRender: {
                            name: 'VxeButtonGroup',
                            options: [
                                { content: '重置', type: 'reset' },
                                { content: '提交', type: 'submit', status: 'primary' }
                            ]
                        }
                    }
                ]
            }
        }
    },
    methods: {
        submit(e) {
            console.log(e)
        }
    }
}
</script>